home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / giochi / knockout.lha / KnockOut.AMOS / KnockOut.amosSourceCode < prev    next >
AMOS Source Code  |  1993-08-18  |  18KB  |  646 lines

  1. ' Knock Out
  2. ' ~~~~~~~~~
  3. ' by Ben Wyatt, bwyatt@paston.co.uk
  4.  
  5. ' Requires Turbo (and probably Craft) extensions 
  6. ' Has to be compiled for it to work :) 
  7.  
  8. ' Info for me: 
  9.  
  10. ' Screens
  11. ' 0 - Main circle screen 
  12. ' 1 - Bridge drawing screen
  13. ' 2 - Dual playfield for "Fight!"
  14. ' 3 - Controls screen
  15. ' 4 - Game type options screen 
  16.  
  17. Set Buffer 35
  18. Degree 
  19.  
  20. MXPL=8
  21. If Prg State=-1
  22.    Break Off : Extension_12_0928 127 : Wait Vbl 
  23.    Timer=0 : For N=1 To 50000 : Next N
  24.    If Timer>34 : MXPL=5 : End If 
  25. End If 
  26. Global MXPL,PL,CSIZE,AN,CAR,SAMREP,ZSTP,TPLAYER,KS,PLONK,GAMETYPE,BCOUNT,BDIR
  27. Dec MXPL
  28.  
  29. Dim X(MXPL),Y(MXPL),XSP(MXPL),YSP(MXPL),ANG(MXPL),SPD(MXPL),CON(MXPL)
  30. Dim WINS(MXPL),DI(MXPL),HIT(MXPL),SPRNUM(MXPL)
  31. Global X(),Y(),XSP(),YSP(),ANG(),SPD(),CON()
  32. Global WINS(),DI(),HIT(),SPRNUM()
  33. Dim QSIN(31),QCOS(31),C(15),CF(7),CCOL(7),CSIN(359),CCOS(359),TWIDTH(9)
  34. Global QSIN(),QCOS(),C(),CF(),CCOL(),CSIN(),CCOS(),TWIDTH()
  35. Dim XPLAT1(45,32),XPLAT2(45,32),YPLAT(45,32),STLIM(4),ENLIM(4)
  36. Global XPLAT1(),XPLAT2(),YPLAT(),STLIM(),ENLIM()
  37.  
  38. _GO
  39.  
  40. Procedure _GO
  41.    
  42.    Def Fn _LEFT=Jleft(1) or Key State(26) or Key State(6) or Key State(100)
  43.    Def Fn _RIGHT=Jright(1) or Key State(27) or Key State(7) or Key State(102)
  44.    Def Fn _FIRE=Fire(1) or Key State(57) or Key State(35) or Key State(96)
  45.    
  46.    PL=MXPL
  47.    _INIT
  48.    For N=0 To MXPL : CON(N)=6 : Next N
  49.    TIM=1 : GAMETYPE=0
  50.    
  51.    Do 
  52.  
  53.       ' Run demo, or game
  54.       Repeat 
  55.          _START
  56.          _GAMEON
  57.          For N=0 To MXPL : CON(N)=Abs(CON(N)) : Next N
  58.       Until KS
  59.  
  60.       For N=0 To MXPL : WINS(N)=0 : Next N
  61.  
  62.       ' Open a screen to display the game type options on
  63.       Screen Open 4,320,256,16,Lowres
  64.       Screen Hide 4
  65.       Screen Display 4,128,37,320,256
  66.       Flash Off : Curs Off : Cls 0
  67.       For N=0 To 15 : Colour N,$555 : Next N
  68.        Extension_12_058A 64,32,19
  69.       Screen Show 4
  70.       Fade 2,,$777,$AAA,$DDD,$0,$2AF,$F54,$2B3,$F90,$B22,$F22,$80,$D0,$CF,$7F,$2F
  71.       Repeat 
  72.          Paste Icon 16,64+16,14-2*(GAMETYPE=0)
  73.          Paste Icon 160,64,15-2*(GAMETYPE=1)
  74.          If Fn _RIGHT and GAMETYPE<1 : GAMETYPE=1 : End If 
  75.          If Fn _LEFT and GAMETYPE>0 : GAMETYPE=0 : End If 
  76.          If Key State(69) : Edit : End If 
  77.       Until Fn _FIRE
  78.       Fade 2,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
  79.       ' Fade up the borders
  80.       For N=5 To 0 Step -1
  81.          Screen Display Screen,,,,
  82.          Colour Back N*256+N*16+N
  83.          Wait Vbl : Wait Vbl 
  84.       Next N
  85.       Wait 12
  86.       PL=MXPL
  87.       If GAMETYPE=1 : PL=3 : End If 
  88.       Screen Close 4
  89.  
  90.       ' Controls screen
  91.       Screen Show 3 : Screen To Front 3
  92.       Screen 3
  93.       Fade 2,$0,,,,,,,,,,,,,,,,$0,$111,$222,$333,$444,$555,$666,$777,$888,$999,$AAA,$BBB,$CCC,$DDD,$EEE,$FFF
  94.       Wait 28
  95.       For N=0 To PL
  96.          If(TIM=1 and N<3) or GAMETYPE=1 : CON(N)=N+1 : End If 
  97.          If CON(N)=7 : CON(N)=6 : End If 
  98.          Fade 1,,,,,,,,,CCOL(N)
  99.          Repeat 
  100.             For M=1 To 6 : Colour M,$F : Next M
  101.             If Fn _RIGHT and CON(N)>1 : Dec CON(N) : Wait 5 : End If 
  102.             LIM=6 : If GAMETYPE=1 : LIM=5 : End If 
  103.             If Fn _LEFT and CON(N)<LIM
  104.                Inc CON(N) : Wait 5
  105.             End If 
  106.             Wait Vbl : Colour CON(N),$FF0
  107.             If Key State(69) : Edit : End If 
  108.             Wait Vbl 
  109.          Until Fn _FIRE
  110.          Repeat : Until Fn _FIRE=False
  111.       Next N
  112.       Fade 2,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555
  113.       ' Fade away the borders
  114.       For N=0 To 5
  115.          Screen Display Screen,,,,
  116.          Colour Back N*256+N*16+N
  117.          Wait Vbl : Wait Vbl 
  118.       Next N
  119.       Wait 12
  120.       Screen Hide 3
  121.       Inc TIM
  122.  
  123.    Loop 
  124.    
  125. End Proc
  126. Procedure _INIT
  127.    
  128.    Colour Back $555
  129.    
  130.    ' Open a screen for drawing the bridge on
  131.    Screen Open 1,64,128,8,Lowres
  132.    Screen Hide 1
  133.    Flash Off : Curs Off : Cls 0
  134.    Ink 4
  135.  
  136.    ' Open a main screen 
  137.    Screen Open 0,320,320+64,8,Lowres
  138.    Screen Display 0,128,37,320,256
  139.    Flash Off : Curs Off : Cls 0
  140.    Screen Hide 0
  141.    If Length(1)=0 : Load "Graphics.Abk" : End If 
  142.    Get Bob Palette : Make Mask 
  143.    Palette $555
  144.    If Length(2)=0 : Load "Icons.Abk" : End If 
  145.    If Length(10)=0 : Load "Controls.Abk",10 : End If 
  146.    If Length(5)=0 : Load "Samples.Abk",5 : End If 
  147.    Sam Bank 5
  148.    Hide On 
  149.    ZSTP=8
  150.    
  151.    ' Open a screen for the controls 
  152.    Screen Open 3,320,256,32,Lowres
  153.    Screen Display 3,128,37,320,256
  154.    Flash Off : Curs Off : Cls 0
  155.    Screen Hide 3
  156.    Unpack 10,0,0 : Erase 10
  157.    For N=0 To 31 : Colour N,$555 : Next N
  158.    
  159.    ' Define the colours 
  160.    CN=0
  161.    For N=0 To 3
  162.       Read C : C(N*4+1)=$0 : C(N*4+2)=C
  163.       CCOL(CN+1)=C : Inc CN
  164.       Read C : C(N*4+3)=C
  165.       CCOL(CN-1)=C : Inc CN
  166.    Next N
  167.    ' Colour data
  168.    Data $F99,$F33,$F3F,$FA5,$39F,$FF3,$3F3,$3FF
  169.  
  170.    ' All the numbers and widths 
  171.    For N=4 To 13
  172.       Make Icon Mask N
  173.    Next N
  174.    For N=0 To 9
  175.       Read TWIDTH(N)
  176.    Next N
  177.    Data 17,11,18,20,19,20,18,17,22,18
  178.  
  179.    Screen Show 0
  180.  
  181.    ' Open a dual playfield screen 
  182.    Screen Open 2,320,256,8,Lowres
  183.    Screen Display 2,128,37,320,256
  184.    Flash Off : Curs Off : Cls 0
  185.    Double Buffer : Autoback 0
  186.    Wait Vbl 
  187.    Dual Playfield 0,2
  188.    Dual Priority 2,0
  189.    
  190.    Screen 0
  191.    
  192.    Volume %10,30
  193.    
  194.    ' Set Hot-Spots to centre of cars
  195.    For N=1 To Length(1)
  196.       Trap Hot Spot N,8,8
  197.    Next N
  198.    
  199.    ' Calculate sins/cosines 
  200.    For N=0 To 359
  201.       CSIN(N)=Sin(N)*1024 : CCOS(N)=Cos(N)*1024
  202.    Next N
  203.    
  204.    ' Predefine all angles 
  205.    For N=0 To 31
  206.       ANG=N*11.25
  207.       QSIN(N)=Sin(ANG)*2048 : QCOS(N)=Cos(ANG)*2048
  208.    Next N
  209.    
  210.    ' Work out the position of the bridge in all possible positions
  211.    For N=0 To 45
  212.       For SIZ=0 To 32
  213.          XPLAT1(N,SIZ)=16.1-(Cos(N*2)*16)/Max(4-SIZ/8,1)
  214.          XPLAT2(N,SIZ)=48+(Cos(N*2)*16)/Max(4-SIZ/8,1)
  215.          YPLAT(N,SIZ)=128-Sin(N*2)*(SIZ*4)
  216.       Next SIZ
  217.    Next N
  218.    
  219.    ' Calculate limits on car input movements
  220.    ' so, cars only move every 4 frames
  221.    For N=0 To 3
  222.       STLIM(N)=PL/3.0*N : ENLIM(N)=PL/3.0*(N+1)
  223.    Next N
  224.    
  225.    Amos To Front 
  226.  
  227. End Proc
  228. Procedure _START
  229.    
  230.    For N=0 To PL
  231.       SPRNUM(N)=1+(N mod 2=0)*(0-280)
  232.    Next N
  233.    If GAMETYPE=1
  234.       CON(4)=7 : ANG(4)=0 : SPRNUM(4)=313 : X(4)=160*2048 : Y(4)=128*2048
  235.       XSP(4)=0 : YSP(4)=0
  236.       If MXPL>4
  237.          For N=5 To MXPL : CON(N)=-Abs(CON(N)) : ANG(N)=266*1024 : Next N
  238.       End If 
  239.    End If 
  240.  
  241.    Screen 0
  242.    CSIZE=110+16*(GAMETYPE=1)
  243.    For N=0 To 15 : Colour N,$555 : Next N
  244.    For N=16 To 31 : Colour N,$AAA : Next N
  245.    
  246.     Extension_12_0380 -1
  247.     Extension_12_045C 160,128,CSIZE,1
  248.    Ink 1 : Paint 160,128
  249.    
  250.    For SIZE=1 To CSIZE Step 5
  251.       STP=2500/(2.0*Pi#*SIZE)
  252.       AN=Rnd(360)
  253.       For ANG=AN To 360-STP+AN Step STP
  254.          Paste Bob 157+Sin(ANG)*SIZE+Rnd(1),126+Cos(ANG)*SIZE,33+Rnd(7)
  255.       Next ANG
  256.    Next SIZE
  257.    
  258.    PLONK=True
  259.    For N=0 To PL
  260.       ANG(N)=360/(PL+1)*N
  261.       X(N)=(160+Sin(ANG(N))*(CSIZE-16))*2048
  262.       Y(N)=(128+Cos(ANG(N))*(CSIZE-16))*2048
  263.       SPD(N)=0 : DI(N)=0
  264.       ANG(N)=(ANG(N)*2+360)/22.5 : XSP(N)=0 : YSP(N)=0
  265.       If ANG(N)>31 : Add ANG(N),-32 : End If 
  266.       If CON(N)<>6 : PLONK=False : End If 
  267.    Next N
  268.    
  269.    If GAMETYPE=0
  270.       For D=0 To PL*8
  271.          C=Rnd(PL) : N=Rnd(PL)
  272.          Swap X(N),X(C) : Swap Y(N),Y(C) : Swap ANG(N),ANG(C)
  273.       Next D
  274.    End If 
  275.  
  276.    If PLONK
  277.       Screen 0
  278.       Colour 5,$9F
  279.       CF(4)=$A00 : CF(5)=$9F
  280.       For X=-34 To 0
  281.          Paste Icon X,0,1 : Wait Vbl 
  282.       Next X
  283.    Else 
  284.       CF(4)=C(3) : CF(5)=C(2) : CF(6)=C(7) : CF(7)=C(6)
  285.       If GAMETYPE=1
  286.          Cls 4,160-16,128+CSIZE To 160+16,128+CSIZE+32
  287.          Cls 5,160+CSIZE,128-16 To 160+CSIZE+32,128+16
  288.          Cls 6,160-16,129-CSIZE-32 To 160+16,129-CSIZE
  289.          Cls 7,161-CSIZE-32,128-16 To 161-CSIZE,128+16
  290.       End If 
  291.    End If 
  292.    
  293.    Colour 9,$FF0
  294.    Wait 10
  295.    
  296.    Screen 2
  297.    For N=80 To 0 Step -ZSTP
  298.        Extension_12_0380 -1
  299.       Paste Bob 160-80,106,265+N/ZSTP
  300.       Screen Swap : Wait Vbl 
  301.    Next N
  302.    Screen 0
  303.    Fade 6,,$777,$AAA,$DDD,CF(4),CF(5),CF(6),CF(7),,$FF0 : Wait 30
  304.    Screen 2
  305.    For N=0 To 80 Step ZSTP
  306.        Extension_12_0380 -1
  307.       Paste Bob 160-80,106,265+N/ZSTP
  308.       Screen Swap : Wait Vbl 
  309.    Next N
  310.     Extension_12_0380 -1 : Screen Swap 
  311.     Extension_12_0380 -1 : Screen Swap 
  312.    Screen 0
  313.    If GAMETYPE=1 : C(10)=$BB0
  314.    Else C(10)=$39F
  315.    End If 
  316.    Fade 12,,,,,,,,,,,,,,,,,,C(1),C(2),C(3),,C(5),C(6),C(7),,C(9),C(10),C(11),,C(13),C(14),C(15)
  317.    
  318. End Proc
  319. Procedure _GAMEON
  320.    
  321.    Every 1 Proc _EVERYPROC
  322.    Every On 
  323.    
  324.    AN=0 : FIN=0 : PLANG=0 : XESC=0 : KS=False
  325.    '   CIRC=3 
  326.    CIRCANG=180 : CIRCDIST=64*(CSIZE+7)
  327.    BCOUNT=0 : BDIR=0
  328.    
  329.    Repeat 
  330.       
  331.       T=PL
  332.       For C=0 To PL
  333.          If ANG(C)>265*1024 : Dec T : End If 
  334.          If Extension_12_044C(X(C)/2048,Y(C)/2048)=0 and CON(C)>0
  335.             CON(C)=-CON(C)
  336.          End If 
  337.       Next C
  338.       If T=-1 : FIN=1 : End If 
  339.       TPLAYER=T
  340.       
  341.       ' Deletion by lines/polygons 
  342.       If T>0 and GAMETYPE=0
  343.          Ink 0
  344.          X1=160+CSIN((CIRCANG+19) mod 360)/1024.0*(CIRCDIST/64+1)
  345.          Y1=128+CCOS((CIRCANG+19) mod 360)/1024.0*(CIRCDIST/64+1)
  346.          X2=160+CSIN((CIRCANG-19) mod 360)/1024.0*(CIRCDIST/64+1)
  347.          Y2=128+CCOS((CIRCANG-19) mod 360)/1024.0*(CIRCDIST/64+1)
  348.          X3=160+CSIN((CIRCANG+19) mod 360)/1024.0*(CIRCDIST/64+3)
  349.          Y3=128+CCOS((CIRCANG+19) mod 360)/1024.0*(CIRCDIST/64+3)
  350.          X4=160+CSIN((CIRCANG-19) mod 360)/1024.0*(CIRCDIST/64+3)
  351.          Y4=128+CCOS((CIRCANG-19) mod 360)/1024.0*(CIRCDIST/64+3)
  352.          Polygon X1,Y1 To X2,Y2 To X3,Y3 To X4,Y4
  353.          Add CIRCANG,12 : Add CIRCDIST,-3
  354.          CSIZE=CIRCDIST/64-6
  355.       End If 
  356.       
  357.       If T<=0 and KS=False
  358.          If PLANG=0 : Get Block 1,160-32,128,64,128 : End If 
  359.          If PLANG<45 : Inc PLANG
  360.          Else 
  361.             T=PL
  362.             For C=0 To PL
  363.                If Y(C)>(255+9)*2048 : FIN=1 : End If 
  364.             Next C
  365.             If T=-1 : FIN=1 : End If 
  366.          End If 
  367.          SIZ=(132-CSIZE)/4
  368.          Screen 1
  369.          Put Block 1,0,0
  370.          Polygon 16,128 To 48,128 To XPLAT2(PLANG,SIZ),YPLAT(PLANG,SIZ) To XPLAT1(PLANG,SIZ),YPLAT(PLANG,SIZ)
  371.          Screen 0 : Screen Copy 1,0,0,64,128 To 0,160-32,128
  372.          Cls 4,160-18,256 To 160+18,320+64
  373.       End If 
  374.  
  375.       If KS=False : KS=Key State(69)
  376.       Else 
  377.          If PLONK : Dec XESC : Paste Icon XESC,0,1 : End If 
  378.       End If 
  379.       
  380.       Repeat : Until Timer>=1 : Timer=0
  381.       
  382.    Until FIN=1
  383.    
  384.    Every Off : Sprite Off 
  385.  
  386.    If KS=False
  387.       WIN=-1
  388.       For C=0 To PL
  389.          If ANG(C)<=265*1024 : WIN=C : End If 
  390.       Next C
  391.       If WIN>-1
  392.          Inc WINS(WIN) : Sam Play %100,2,Rnd(2000)+8000
  393.       End If 
  394.    End If 
  395.  
  396.    For N=8 To 15 : Colour N,$555 : Next N
  397.    Screen 2
  398.    For N=PL To 0 Step -1
  399.       SCORE$=Str$(WINS(N))
  400.       N1=4+Val(Mid$(SCORE$,Len(SCORE$)-1,1))
  401.       N2=4+Val(Right$(SCORE$,1))
  402.       X1=160-TWIDTH(N1-4) : X2=160
  403.       Paste Icon X1,N*24,N1 : Extension_12_058A X2,N*24,N2
  404.       Paste Icon 96,N*24,2 : Paste Icon 320-25-96,N*24,3
  405.    Next N
  406.    If PLONK=False : Paste Icon 64+12,192,18 : End If 
  407.    Screen Swap : Wait Vbl 
  408.    Screen 0
  409.    C=$555
  410.    Fade 4,C,C,C,C,C,C,C,C,0,0,0,0,$9F,$F33,$F0
  411.    Wait 40
  412.    For N=0 To PL : X(N)=108*32 : XSP(N)=0 : Next N
  413.    Repeat 
  414.       OKAY=True
  415.       For N=0 To PL
  416.          Sprite N,X Hard(X(N)/32),Y Hard(N*24+9),8+SPRNUM(N)
  417.          If X(N)=108*32
  418.             Gosub 0+Abs(CON(N))
  419.             If A : Inc X(N) : End If 
  420.             OKAY=False
  421.          Else 
  422.             Add X(N),XSP(N)/2
  423.             ' 321*16 is same as 160.5*32 
  424.             If X(N)<321*16 : Inc XSP(N) : OKAY=False
  425.             Else 
  426.                If XSP(N)>0 : Dec XSP(N) : OKAY=False : End If 
  427.             End If 
  428.          End If 
  429.       Next N
  430.       If KS=False : KS=Key State(69) : End If 
  431.       Wait Vbl 
  432.    Until OKAY
  433.    Fade 2,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C
  434.  
  435.    Wait 32
  436.    Screen 2 : Screen Swap : Wait Vbl : Extension_12_0380 -1
  437.    Screen 0
  438.    Sprite Off 
  439.  
  440.    Goto EN
  441.  
  442.    1 Rem Joy 1
  443.    A=Fire(1) or(KS and Rnd(100)>97)
  444.    Return 
  445.    
  446.    2 Rem Joy 0
  447.    A=Fire(0) or(KS and Rnd(100)>97)
  448.    Return 
  449.    
  450.    3 Rem {[,}],>. 
  451.    A=Key State(57) or(KS and Rnd(100)>97)
  452.    Return 
  453.    
  454.    4 Rem 6,7,F
  455.    A=Key State(35) or(KS and Rnd(100)>97)
  456.    Return 
  457.    
  458.    5 Rem LALT,LAMIGA,LSHIFT 
  459.    A=Key State(96) or(KS and Rnd(100)>97)
  460.    Return 
  461.    
  462.    6 Rem Computer 
  463.    A=False : If Rnd(100)>97 : A=True : End If 
  464.    Return 
  465.  
  466.    EN:
  467.  
  468. End Proc
  469. Procedure _EVERYPROC
  470.    
  471.    Every On 
  472.    
  473.    Add AN,1,0 To 3 : Add CAR,1,0 To PL : Dec SAMREP
  474.    
  475.    For N=0 To MXPL
  476.       XSPD=XSP(N)/16 : YSPD=YSP(N)/16
  477.       If CON(N)>-1
  478.          Add X(N),XSPD : Add Y(N),YSPD
  479.          If Sprite Col(N,0 To PL)
  480.             CO=Col(-1)
  481.             If HIT(CO)<>HIT(N) or HIT(CO)=0
  482.                If SAMREP<0
  483.                   SAMREP=8
  484.                   Volume %1,Min((Abs(XSP(N)/16)+Abs(XSP(CO)/16)+Abs(YSP(N)/16)+Abs(YSP(CO)/16))/64,63)
  485.                   Sam Play %1,1,Rnd(4000)+3000
  486.                End If 
  487.                Add X(N),-XSPD : Add Y(N),-YSPD
  488.                Add X(CO),-XSP(CO)/16 : Add Y(CO),-YSP(CO)/16
  489.                Swap XSP(N),XSP(CO) : Swap YSP(N),YSP(CO)
  490.                Add X(N),XSP(N)/16 : Add Y(N),YSP(N)/16
  491.                Add X(CO),XSP(CO)/16 : Add Y(CO),YSP(CO)/16
  492.                Sprite CO,X Hard(X(CO)/2048),Y Hard(Y(CO)/2048),ANG(CO)+SPRNUM(CO)
  493.                HIT(N)=CO : HIT(CO)=N
  494.             End If 
  495.          Else HIT(N)=0
  496.          End If 
  497.          XCAR= Extension_12_006A(X(N),11) : YCAR= Extension_12_006A(Y(N),11)
  498.          If N>=STLIM(AN) and N<ENLIM(AN)
  499.             Gosub 0+CON(N)
  500.             If L : Add ANG(N),1,0 To 31 : End If 
  501.             If R : Add ANG(N),-1,0 To 31 : End If 
  502.             If A
  503.                If SPD(N)<135 : Add SPD(N),45 : End If 
  504.             Else SPD(N)=SPD(N)/2
  505.             End If 
  506.             Add XSP(N),QSIN(ANG(N))*SPD(N)/128-XSPD+XSPD/2
  507.             Add YSP(N),QCOS(ANG(N))*SPD(N)/128-YSPD+YSPD/2
  508.          End If 
  509.          Sprite N,X Hard(XCAR),Y Hard(YCAR),ANG(N)+SPRNUM(N)
  510.       Else 
  511.          If ANG(N)<=265*1024
  512.             If ANG(N)<=265
  513.                If ANG(N)<32
  514.                   Add ANG(N),42 : Sam Play %10,3,Rnd(2000)+8000
  515.                   XSP(N)=XSP(N)*2 : YSP(N)=YSP(N)*2
  516.                End If 
  517.                Sprite N,X Hard(X(N)/2048),Y Hard(Y(N)/2048),ANG(N)+SPRNUM(N)
  518.                Add ANG(N),32
  519.                Add X(N),XSPD : Add Y(N),YSPD
  520.                ANG(N)=ANG(N)*1024
  521.             Else ANG(N)=ANG(N)/1024
  522.             End If 
  523.          Else Sprite Off N
  524.          End If 
  525.       End If 
  526.    Next N
  527.    
  528.    Goto EN
  529.    
  530.    1 Rem Joy 1
  531.    L=(Jleft(1) and KS=False) or(KS and Rnd(100)>97)
  532.    R=(Jright(1) and KS=False) or(KS and Rnd(100)>97)
  533.    A=Fire(1) or KS
  534.    Return 
  535.    
  536.    2 Rem Joy 0
  537.    L=(Jleft(0) and KS=False) or(KS and Rnd(100)>97)
  538.    R=(Jright(0) and KS=False) or(KS and Rnd(100)>97)
  539.    A=Fire(0) or KS
  540.    Return 
  541.    
  542.    3 Rem {[,}],>. 
  543.    L=(Key State(26) and KS=False) or(KS and Rnd(100)>97)
  544.    R=(Key State(27) and KS=False) or(KS and Rnd(100)>97)
  545.    A=Key State(57) or KS
  546.    Return 
  547.    
  548.    4 Rem 6,7,F
  549.    L=(Key State(6) and KS=False) or(KS and Rnd(100)>97)
  550.    R=(Key State(7) and KS=False) or(KS and Rnd(100)>97)
  551.    A=Key State(35) or KS
  552.    Return 
  553.    
  554.    5 Rem LALT,LAMIGA,LSHIFT 
  555.    L=(Key State(100) and KS=False) or(KS and Rnd(100)>97)
  556.    R=(Key State(102) and KS=False) or(KS and Rnd(100)>97)
  557.    A=Key State(96) or KS
  558.    Return 
  559.    
  560.    6 Rem Computer 
  561.    RN=Rnd(100) : R=False : L=False : A=True
  562.    If RN=3 : A=False : End If 
  563.    If KS=False
  564.       If DI(N)=0 or RN>95
  565.          ANP=((Rnd(1)+1)*2-3)
  566.          If ANP<>DI(N) and DI(N)<>0 : DI(N)=0
  567.          Else DI(N)=ANP
  568.          End If 
  569.          ANP=ANP*8
  570.       Else ANP=DI(N)*8
  571.       End If 
  572.       ANG=ANG(N)+ANP
  573.       If ANG>31 : Add ANG,-32 : End If 
  574.       If ANG<0 : Add ANG,32 : End If 
  575.       TNOP=(Abs(XSPD)+Abs(YSPD))/32
  576.       If Extension_12_044C(XCAR+(XSPD+QSIN(ANG)*TNOP)/2048,YCAR+(YSPD+QCOS(ANG)*TNOP)/2048)<=0
  577.          If Sgn(ANP)=-1 : R=False : L=True : DI=-1
  578.          Else R=True : L=False : DI=1
  579.          End If 
  580.          If DI<>DI(N) and DI(N)<>0 : DI(N)=0 : End If 
  581.       Else 
  582.          If Sgn(ANP)=-1 : L=False : R=True : DI=1
  583.          Else L=True : R=False : DI=-1
  584.          End If 
  585.          If DI<>DI(N) and DI(N)<>0 : DI(N)=0 : End If 
  586.       End If 
  587.    End If 
  588.    ' If all the other players are dead
  589.    If TPLAYER=0 and KS=False
  590.       If XCAR>160-16 and XCAR<160+16
  591.          A=False
  592.          If ANG(N)>28 or ANG(N)<4
  593.             A=True : L=False : R=False
  594.             If ANG(N)>30 or ANG(N)<2
  595.                A=True
  596.                If XCAR>160-4 and XCAR<160+4
  597.                   If ANG(N)=31 : L=True : End If 
  598.                   If ANG(N)=1 : R=True : End If 
  599.                Else 
  600.                   If XCAR<160 : L=True
  601.                   Else R=True
  602.                   End If 
  603.                End If 
  604.             Else 
  605.                If ANG(N)<16 : R=True
  606.                Else L=True
  607.                End If 
  608.             End If 
  609.          Else 
  610.             If ANG(N)<16 : R=True
  611.             Else L=True
  612.             End If 
  613.          End If 
  614.       End If 
  615.    End If 
  616.    Return 
  617.  
  618.    7 Rem The Ball 
  619.    L=False : R=False : A=False
  620.    Dec BCOUNT
  621.    If TPLAYER<>0
  622.       FP=1
  623.       If BCOUNT<0 : FP= Extension_12_044C(XCAR,YCAR) : End If 
  624.       If FP>3 : Inc WINS(FP-4) : BCOUNT=4 : SPRNUM(4)=318 : BDIR=0
  625.       Else 
  626.          If FP=0 : BCOUNT=2 : BDIR=1 : End If 
  627.       End If 
  628.       If BCOUNT=0
  629.          X(N)=160*2048 : Y(N)=128*2048
  630.          XSP(N)=0 : YSP(N)=0
  631.          SPRNUM(4)=318 : BDIR=-1
  632.       Else 
  633.          If BCOUNT>0 : XSP(N)=0 : YSP(N)=0 : End If 
  634.       End If 
  635.       If BDIR<>0
  636.          Add SPRNUM(4),BDIR
  637.          If SPRNUM(4)=318 : BCOUNT=1 : BDIR=0 : End If 
  638.          If SPRNUM(4)=313 : BDIR=0 : End If 
  639.       End If 
  640.    Else SPRNUM(4)=319 : Sprite Off 4
  641.    End If 
  642.    Return 
  643.    
  644.    EN:
  645.    
  646. End Proc